Add macro for exported variables
authorEmmanuele Bassi <ebassi@gnome.org>
Tue, 7 Apr 2020 22:32:22 +0000 (23:32 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 8 Apr 2020 14:40:15 +0000 (15:40 +0100)
The logic is based on the similar macro in GLib, but with the
appropriate GDK symbols.

gdk/gdktypes.h

index 9e8a7997fa374e58094548cb4ce3b3827a7e4c4b..39f151d7babc9cce4aad20863deb90ed0d9605d6 100644 (file)
@@ -557,4 +557,26 @@ struct _GdkKeymapKey
 
 G_END_DECLS
 
+/*< private >
+ * GDK_EXTERN_VAR:
+ *
+ * A macro to annotate extern variables so that they show up properly in
+ * Windows DLLs.
+ */
+#ifndef GDK_EXTERN_VAR
+#  ifdef G_PLATFORM_WIN32
+#    ifdef GTK_COMPILATION
+#      ifdef DLL_EXPORT
+#        define GDK_EXTERN_VAR __declspec(dllexport)
+#      else /* !DLL_EXPORT */
+#        define GDK_EXTERN_VAR extern
+#      endif /* !DLL_EXPORT */
+#    else /* !GTK_COMPILATION */
+#      define GDK_EXTERN_VAR extern __declspec(dllimport)
+#    endif /* !GTK_COMPILATION */
+#  else /* !G_PLATFORM_WIN32 */
+#    define GDK_EXTERN_VAR _GDK_EXTERN
+#  endif /* !G_PLATFORM_WIN32 */
+#endif /* GDK_EXTERN_VAR */
+
 #endif /* __GDK_TYPES_H__ */